<!DOCTYPE html>
<html>
{include file="public/header" /}
<body>
<style>
    .layui-input-inline{
        width: 400px !important;
    }
</style>
<div class="layui-fluid" id="app">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card" >
                <!--<div class="layui-card-header">商品列表</div>-->
                <div class="layui-card-body">

                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                        <ul class="layui-tab-title">
                            <li class="" onclick="go('index')">帮助中心</li>
                            <li class="layui-this">帮助新增</li>

                        </ul>
                        <div class="layui-tab-content" style="padding-left: 0px;padding-right: 0px">


                            <div class="layui-tab-item layui-show" style="padding-top: 15px">
                                <form class="layui-form " action="">

                                    <div class="layui-form-item">
                                        <div style="float: left" class="layui-col-md6">
                                            <label class="layui-form-label">分类</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="class_id" value="" class="layui-input"
                                                       lay-verify="required" placeholder="请输入分类id">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div style="float: left" class="layui-col-md6">
                                            <label class="layui-form-label">问题标题</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="title" value="" class="layui-input"
                                                       lay-verify="required" placeholder="请输入问题标题">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div style="float: left" class="layui-col-md6">
                                            <label class="layui-form-label">问题回答</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="content" value="" class="layui-input"
                                                       lay-verify="required" placeholder="请输入问题回答">
                                            </div>
                                        </div>
                                    </div>


                                    <!--<div class="layui-form-item">-->
                                        <!--<div style="float: left" class="layui-col-md6">-->
                                            <!--<label class="layui-form-label">排序</label>-->
                                            <!--<div class="layui-input-block">-->
                                                <!--<input type="text" name="sort" value="" class="layui-input" placeholder="请输入输入数字">-->
                                            <!--</div>-->
                                        <!--</div>-->
                                    <!--</div>-->
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit lay-filter="add_project">保存</button>
                                            <button class="layui-btn" lay-submit lay-filter="send_project">保存并发布</button>
                                            <button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
                                        </div>
                                    </div>
                                </form>
                            </div>

                        </div>
                    </div>


                </div>


            </div>

        </div>


    </div>
</div>



<script>
    var app = new Vue({
        el: '#app',
        data: {
        },
    });
    layui.use(['form', 'upload', 'laydate'], function () {
        var $ = layui.$
            , layer = layui.layer
            , form = layui.form;
        var upload = layui.upload;
        var laydate = layui.laydate;
        form.on('submit(add_project)', function (obj) {
            obj.field["s"]='add';
//            layer.msg(JSON.stringify(obj.field)); obj.field为当前容器的全部表单字段，名值对形式：{name: value}
            $.post("{:url('add_pro')}", obj.field,function (res) {
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1});
                    $('.layui-form')[0].reset();
                    return false;
                } else {
                    layer.msg(res.msg, {icon: 2}, function () {

                    })
                    return false;
                }

            });
            return false;
        });
        form.on('submit(send_project)', function (obj) {

            obj.field["s"]='send';
//            layer.msg(JSON.stringify(obj.field)); obj.field为当前容器的全部表单字段，名值对形式：{name: value}
            $.post("{:url('add_pro')}", obj.field, function (res) {
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1});
                    $('.layui-form')[0].reset();
                    return false;
                } else {
                    layer.msg(res.msg, {icon: 2}, function () {

                    })
                    return false;
                }

            });
            return false;
        });


    });
</script>
